const express = require('express')
const router = express.Router();
const Device = require('../controllers/device')
const Setting = require('../setting')

router.get('/getAll', ((req, res) => {
  Device.findAll({},(data) => {
        res.send({code: Setting.Success, data: data})
    })
}))

router.post('/getById', ( async (req, res) => {
  let {id} = req.body
  Device.findById(id, device => res.send({code: Setting.Success, data: device}))
}))
module.exports = router;
